package com.bite;

public class BinarySearchTree {

    static class TreeNode {
        public int key;
        public TreeNode left;
        public TreeNode right;

        TreeNode(int key) {
            this.key = key;
        }
    }

    public TreeNode root;

    /**
     * 插入一个元素
     * @param key
     */
    public boolean insert(int key) {
            
        return true;
    }
    //查找key是否存在
    public TreeNode search(int key) {
       TreeNode cur = root;
       while(cur != null){
           if(key == cur.key){
               return cur;
           }else if(key < cur.key){
               cur = cur.left;
           }else{
               cur = cur.right;
           }
       }
        return null;
    }
    //删除key的值
    public boolean remove(int key) {

        return false;
    }


}
